
<nav class="navbar navbar-default subnav ">

    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand active" href="#">爬虫管理</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li>
                <a href="#/flowcrawl">FlowCrawl爬虫配置</a>
                </li>
                <li>
                <a href="#/detail">爬虫插件详情</a>
                </li>
            </ul>
        </div>
    </div>
</nav>


<div class="index-pannel-nav-nospace masthead">
    <div class="container">
        <div class="col-md-4">
            <h2>Spider Schedule</h2>
            <p style="display: none;">插件式爬虫调度</p>
        </div>
        <div class="col-md-8">
        </div>
    </div>
</div>

<div class="container plugin-pannel">
    <div class="col-md-4">
        <input class="col-md-12" ng-model="query" placeholder="Local Search">
        <div class="col-md-12"><br/></div>
        <div class="col-md-12" style="border:2px solid #ccc;">
            <h4>上传插件包 : </h4>
            <input type="file" ng-file-select="on_fileselect($files)">
            <br/>
            <div class="progress">
                <div class="progress-bar" role="progressbar" aria-valuenow="{{upload_percent}}" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
                    {{upload_percent}}%
                </div>
            </div>
            <button class="button button-small button-raised button-capitalize" ng-click="plugin_file_exists()">开始上传</button>
        <div class="col-md-12"><br/></div>
        </div>
    </div>

    <div class="col-md-8">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
        <div class="panel panel-default" ng-repeat="pinfo in plugin_info |  orderBy:'name' | filter:query">
            <div class="panel-heading" role="tab" id="heading{{pinfo.name}}">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" cdata="collapse{{pinfo.name}}" ng-click="on_collapse_click($event.target)" aria-expanded="true" aria-controls="collapse{{pinfo.name}}">
                        {{pinfo.name}}
                    </a>
                    <a class="button button-small button-raised button-capitalize" href="#/detail/{{pinfo.name}}" style="float:right; font-size:12px; margin-top:-5px;">爬虫详情</a>
                </h4>
            </div>
            <div id="collapse{{pinfo.name}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{pinfo.name}}">
                <div class="panel-body">
                    <ul class="list-group">
                        <li class="list-group-item" ng-repeat="plugin in pinfo.plugins">
                        <span class="badge" ng-show="{{plugin.processable}}">M</span>
                        <span class="badge" ng-show="{{plugin.isProcessing}}">R</span>
                        <span class="badge" ng-show="{{plugin.isLaunched}}">L</span> 
                        <h4 class="list-group-item-heading">{{plugin.qualified}}</h4>
                        <ul>
                            <li>
                            <p class="list-group-item-text">描述:</p>
                            <p class="list-group-item-text" style="color:#688;">{{plugin.desc}}</p>
                            </li>
                            <li>
                            <p class="list-group-item-text">开始方式: <span style="color:#688;">{{plugin.startMethod}}</span></p>
                            </li>
                        </ul>
                        <div ng-show="{{plugin.startMethod === 'xml'}}">
                            <ul>
                                <li>
                                <p class="list-group-item-text">爬取首页:</p>
                                <p class="list-group-item-text" style="color:#688;" ng-repeat="req in plugin.startRequests">{{req.link}} | {{req.groupName}}</p>
                                </li>
                            </ul>
                        </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="fileExistsModal" tabindex="-1" role="dialog" aria-labelledby="sendgroupModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="sendgroupModalTitle">插件包已经存在</h4>
            </div>
            <div class="modal-body">
                <h5>您选择的包在服务器上已经存在，是否覆盖？</h5>
                <p>覆盖将停止此插件的所有任务。</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="button button-small button-raised button-capitalize" data-dismiss="modal">取消</button>
                <button type="button" class="button button-primary button-small button-raised button-capitalize" data-dismiss="modal" ng-click="on_upload()">上传并覆盖</button>
            </div>
        </div>
    </div>
</div>

